﻿using System.Linq;
using LINQtoFxCop.Core;

namespace LINQtoFxCop.Metrics
{
  public static class ApplicationMetrics
  {
    public static int NbILInstructions(this ApplicationNode application)
    {
      return application.Types.Sum(type => type.NbILInstructions());
    }
    public static int NbFields(this ApplicationNode application)
    {
      return application.Types.Sum(type => type.NbFields());
    }
    public static int NbAssemblies(this ApplicationNode application)
    {
      return application.Assemblies.Count();
    }
    public static int NbTypes(this ApplicationNode application)
    {
      return application.Types.Count();
    }
    public static int NbNamespaces(this ApplicationNode application)
    {
      return application.Namespaces.Count();
    }
    public static int NbMethods(this ApplicationNode application)
    {
      return application.Assemblies.Sum(assembly => assembly.NbMethods());
    }
  }
}
